package com.print.ane.funs;

import android.content.pm.PackageManager.NameNotFoundException;

import com.adobe.fre.FREContext;
import com.adobe.fre.FREFunction;
import com.adobe.fre.FREObject;
import com.adobe.fre.FREWrongThreadException;

public class CheckPrintShare implements FREFunction {

	@Override
	public FREObject call(FREContext context, FREObject[] arg1) {
		String packet = null;
		try{
			packet = arg1[0].getAsString();
		}catch(Exception e){
			
		}
		if(packet == null){
			return null;
		}
		try {
			context.getActivity().getPackageManager()
					.getPackageInfo(packet, 0);
			try {
				return FREObject.newObject(true);
			} catch (FREWrongThreadException e) {
			}
		} catch (NameNotFoundException e) {
			try {
				return FREObject.newObject(false);
			} catch (FREWrongThreadException e1) {
			}
		}
		return null;
	}
}
